import http from "@/utils/http";

//启用禁用账号
export const EnableAccount = (data: any) =>
  http({
    url: "/api/account/setactive",
    method: "post",
    data,
  });

//创建账号
export const addAccount = (data: any) =>
  http({
    url: "/api/account/create",
    method: "post",
    data,
  });

//获取账号分页列表
export const getAccountList = (
  data = {
    LoginAccount: "",
    UserName: "",
    pageIndex: 1,
    pageSize: 50,
    SortField: "id",
    SortOrder: "desc",
  }
) =>
  http({
    url: "/api/account/getbypage",
    method: "get",
    query: data,
  });

//修改账号
export const EditAccount = (data: any) =>
  http({
    url: `/api/account/update/${data.userId}`,
    method: "put",
    data,
  });

//删除账号
export const deleteAccount = (data: any) =>
  http({
    url: `/api/account/delete/${data.userId}`,
    method: "delete",
  });

//修改密码
export const changePassword = (data: any) =>
  http({
    url: "/api/account/changepassword",
    method: "post",
    data,
  });

//重置密码
export const resetPassword = (data: any) =>
  http({
    url: `/api/account/resetpassword/${data.userId}`,
    method: "post",
  });

//重置TFA
export const resetTFA = (data: any) =>
  http({
    url: "/api/account/resettfa",
    method: "post",
    data,
  });

//获取指定账号信息
export const getUserInfo = (data: any) =>
  http({
    url: `/api/account/get/${data.userId}`,
    method: "get",
    data,
  });
